package com.example.sakurasay

import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.activity.enableEdgeToEdge
import androidx.activity.viewModels
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import android.view.WindowManager
import com.example.sakurasay.main.MainScreen
import com.example.sakurasay.ui.theme.SakuraSayTheme
import androidx.activity.viewModels
import androidx.compose.runtime.collectAsState
import androidx.compose.runtime.getValue
import com.example.sakurasay.main.MainScreen
import com.example.sakurasay.ui.theme.SakuraSayTheme
import com.example.sakurasay.viewmodels.SettingsViewModel
import com.example.sakurasay.viewmodels.ThemeViewModel
import androidx.fragment.app.FragmentActivity

class MainActivity : FragmentActivity() {
    private val themeViewModel: ThemeViewModel by viewModels()
    private val settingsViewModel: SettingsViewModel by viewModels()

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        enableEdgeToEdge()
        setContent {
            val themeUiState by themeViewModel.uiState.collectAsState()

            SakuraSayTheme(darkTheme = themeUiState.isDarkTheme) {
                MainScreen(
                    themeViewModel = themeViewModel,
                    settingsViewModel = settingsViewModel
                )
            }
        }
    }
}